//
//  ViewController.m
//  AutoLayoutAnimation
//
//  Created by dllo on 16/8/22.
//  Copyright © 2016年 ZHW. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *centerY;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutLeft150;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutLeft20;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
}

- (IBAction)startAnimation:(UIButton *)sender {
//    // 改变centerY的constant
//    self.centerY.constant = -200;
//    // 执行动画效果
//    [UIView animateWithDuration:5 animations:^{
//        // 必须调用layoutIfNeeded
//        [self.view layoutIfNeeded];
//    }];
    
    // 约束的优先级想要改变, 不能设置初始值为1000
    // 同一约束优先级高的会被执行,
    self.layoutLeft20.priority = 751;
    self.layoutLeft150.priority = 750;
    [UIView animateWithDuration:5 animations:^{
        [self.view layoutIfNeeded];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
